package com.itheima.mapper;

import com.itheima.domain.Classes;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface ClassesMapper {

    @Select("select * from classes")
    @Results(
            {
                    @Result(column = "cid", property = "cid", id = true),
                    @Result(column = "cname",property = "cname"),

                    @Result(
                            property = "studentList",
                            javaType = List.class,
                            column = "cid",
                            many = @Many(select = "com.itheima.mapper.StudentMapper.findByCid")

                    )
            }
    )
    List<Classes> findAll();

}
